package cn.chenhongchao.zhaobiaopingtai.controller;


import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.OpenBidDTO;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.BusinessBid;
import cn.chenhongchao.zhaobiaopingtai.entity.ReturnBid;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BusinessBidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/tenderOpenBusiness")
@CrossOrigin
public class BusinessBidController {


    @Autowired
    private BusinessBidServiceImpl businessBidService;

    @Autowired
    private TenderServiceImpl tenderService;

    @RequestMapping("getOpenBusinessList")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize,
                                        @RequestBody ReturnBidDTO returnBidDTO) {

        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 1;
        }

        // 查询带了数据 需要动态查询  mybatis-plus
        CommonPage<OpenBidDTO> returnBidCommonPage = tenderService.getTenderList(pageNum, pageSize, returnBidDTO);
        return CommonResult.success(returnBidCommonPage);

    }
}
